from tkinter import font
import matplotlib.pyplot as plt
import pandas as pd
plt.rcParams['svg.fonttype'] = 'none'

# 创建数据框架
data = {
    'Round': [10, 20, 30, 40, 50, 60, 70, 80],
    'SPS': [63.166666666666664,
  28.666666666666668,
  17.35483870967742,
  13.487179487179487,
  8.652173913043478,
  6.745762711864407,
  6.013888888888889,
  5.192771084337349],
 'OGS': [49.8,
  13.333333333333334,
  6.769230769230769,
  5.222222222222222,
  4.108695652173913,
  3.263157894736842,
  2.611111111111111,
  2.210526315789474],
 'ORDP': [43.5,
  18.877365805309665,
  18.230149843450736,
  11.26595744680851,
  9.039971983205437,
  8.999806437554778,
  6.84124030117099,
  5.830291555439434]
}

df = pd.DataFrame(data)

# 绘制数据
plt.figure(figsize=(8, 6))
plt.plot(df['Round'], df['SPS'], marker='s', markersize=10, label='SPS')
plt.plot(df['Round'], df['OGS'], marker='^', markersize=10, label='OGS')
plt.plot(df['Round'], df['ORDP'], marker='*', markersize=10, label='ORDP')

# plt.title('Comparison of SPF and Cplex Algorithms')
plt.xlabel('Avg. Link Capacity', fontsize=14)
plt.ylabel('Congestion Ratio', fontsize=14)
plt.legend(fontsize='large')  # 设置图例的字体大小为大

plt.grid(True)
# plt.show()
plt.savefig("output/cr_var_capacity.svg", format="svg")
